import 'babel-polyfill'
import Vue from 'vue'
import Router from 'vue-router'

/* home */
// const Index = () => import('page/home/index')
// import Index from '@/views/home/index'
/* cms */

/* member */
import Author from '@/views/member/author'
import addressList from '@/views/member/addressList'
import address from '@/views/member/address'
// import Address from 'page/member/address'
// /* member */

/* shop */
import Shop from '@/views/shop/index'
import Product from '@/views/shop/product'
import createOrder from '@/views/shop/createOrder'
import Cart from '@/views/shop/cart'
import pay from '@/views/shop/pay'
import paySuccess from '@/views/shop/paySuccess'

// import Pay from 'page/shop/pay'
// import PaySuccess from 'page/shop/paySuccess'

/* shop */
/* order */

import Order from '@/views/order/orderList'
import orderDetails from '@/views/order/orderDetails'
import RefundDetails from '@/views/order/refundDetails'
import RefundApply from '@/views/order/refundApply'
import fillRefundInfo from '@/views/order/fillRefundInfo'
import fillExpress from '@/views/order/fillExpress'

const appRouter = {
  mode: 'history',
  base: '/shareapp/',
  routes: [
    {
      path: '',
      redirect: '/shop'
    },
    {
      path: '/shop',
      name: 'shop',
      component: Shop,
      meta: {
        keepAlive: true,
        isBack: true // 用于判断上一个页面是哪个
      }
    },
    {
      path: '/author',
      name: 'author',
      component: Author,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/product',
      name: 'product',
      component: Product,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/createOrder',
      name: 'createOrder',
      component: createOrder,
      meta: { keepAlive: false }
    },
    {
      path: '/addressList',
      name: 'addressList',
      component: addressList,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/address',
      name: 'address',
      component: address,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/cart',
      name: 'cart',
      component: Cart,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/pay',
      name: 'pay',
      component: pay,
      meta: { keepAlive: false }
    },
    {
      path: '/paysuccess',
      name: 'paysuccess',
      component: paySuccess,
      meta: { keepAlive: false }
    },
    {
      path: '/order',
      name: 'order',
      component: Order,
      meta: { keepAlive: false }
    },
    {
      path: '/orderDetails',
      name: 'orderDetails',
      component: orderDetails,
      meta: { keepAlive: false }
    },
    {
      path: '/refundApply',
      name: 'refundApply',
      component: RefundApply,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/refundDetails',
      name: 'refundDetails',
      component: RefundDetails,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/fillRefundInfo',
      name: 'fillRefundInfo',
      component: fillRefundInfo,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/fillExpress',
      name: 'fillExpress',
      component: fillExpress,
      meta: {
        keepAlive: false
      }
    }
    // {
    //   path: '/product/:id',
    //   name: 'product',
    //   component: Product,
    //   meta: {
    //     keepAlive: false
    //   }
    // },

    // {
    //   path: '/address/:id?',
    //   name: 'address',
    //   component: Address,
    //   meta: { keepAlive: false }
    // },
    // {
    //   path: '/pay',
    //   name: 'pay',
    //   component: Pay,
    //   meta: { keepAlive: false }
    // },
    // {
    //   path: '/paysuccess',
    //   name: 'paysuccess',
    //   component: PaySuccess,
    //   meta: { keepAlive: false }
    // }
  ]
}
//  部署线上记得吧这行代码注释掉
// import sunnie from '@/router/sunnie'
// sunnie.map(i => {
//   appRouter.routes.push(i)
// })
Vue.use(Router)
export default new Router(appRouter)
